package com.zst.polyphiasongsservice.controller;

import com.alibaba.fastjson.JSONObject;
import com.zst.polyphiasongsservice.context.UserContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController()
@RequestMapping("/polyphia")
public class PolyphiaController {
    @Autowired
    private Environment env;

    @RequestMapping("{albumName}")
    public Object newLevelsNewDevils(@PathVariable("albumName") String albumName) throws InterruptedException {
        JSONObject result = new JSONObject();
        switch (albumName){
            case "NewLevelsNewDevils":
                result.put("key", "value");
                break;
            default:
                result.put("default", env.getProperty("phlyphia.muse.first"));
                result.put("collarate", UserContextHolder.getContext().getCorrelationId());
        }
        return result;
    }

    @RequestMapping("/sleuthLogTest")
    public Object sleuthLogTest(){

    }
}
